package org.wtfbbq.net.wifi;
import java.util.*;

public class Test {
	public static void main ( String[] args ) throws Exception {
		Radar r = new Radar();
		ArrayList<AccessPoint> t = null;
		//while ( true ) {
			Thread.sleep(50);
			t = r.scanAccessPoints();
			for ( int i = 0 ; i < t.size() ; i++ ) {
				//if ( t.get(i).getBSSID().equals("00:03:52:f4:c5:b0") ) {
					System.out.println( t.get(i).getBSSID() + " : " + t.get(i).getSignal() );
				//}
			}
		//}
	}
	
	public static void bench_s( ) throws Exception {
		Radar r = new Radar();
		int min = Integer.MAX_VALUE;
		int max = 0;
		long total = 0;
		int count = 0;
		for ( int j = 0 ; j < 1000 ; j++ ) {
			long pre = System.currentTimeMillis();
			r.scan();
			long delta = System.currentTimeMillis() - pre;
			if ( delta < min ) {
				min = (int)delta;
			}
			if ( delta > max ) {
				max = (int)delta;
			}
			count++;
			total += delta;
			System.out.println("Time: " + delta + " ms");
			Thread.sleep(100);
		}
		
		System.out.println( "Min: " + min );
		System.out.println( "Max: " + max );
		System.out.println( "Avg: " + ( total / count ) );
	}
	
	public static void bench_c( ) throws Exception {
		Radar r = new Radar();
		int min = Integer.MAX_VALUE;
		int max = 0;
		long total = 0;
		int count = 0;
		for ( int j = 0 ; j < 1000 ; j++ ) {
			long pre = System.currentTimeMillis();
			Runtime.getRuntime().exec("netsh wlan show networks mode=bssid");
			long delta = System.currentTimeMillis() - pre;
			if ( delta < min ) {
				min = (int)delta;
			}
			if ( delta > max ) {
				max = (int)delta;
			}
			count++;
			total += delta;
			System.out.println("Time: " + delta + " ms");
			Thread.sleep(100);
		}
		
		System.out.println( "Min: " + min );
		System.out.println( "Max: " + max );
		System.out.println( "Avg: " + ( total / count ) );
	}
}